package com.hiwhitley.easy.day08;

import com.hiwhitley.base.TreeNode;

/**
 * Created by hiwhitley on 2016/8/12.
 */
public class IsSameTree {
    public boolean isSameTree(TreeNode p, TreeNode q) {
        if (p == null && q == null) return true;
        if ((p == null && q != null) || (p != null && q == null)) return false;
        return isSameTree(p.left, q.left) && isSameTree(p.right, q.right) && (p.val == q.val);
    }
}
